import serveUrl from "@/config/serverAddress"; // 接口域名列表
import axios from "@/config/http"; // 导入http中创建的axios实例

const importUser = {

  /**
   * @api{property} 获取导入列信息
   */
  GetImportColumns(data) {
    return axios.post(`${serveUrl.rs}/EmployeeImportV2/GetImportColumns?moduleCode=${data.moduleCode}&isSimple=${data.isSimple}`, data.formData);
  },

  /**
   * @api{property} 获取导入列信息
   */
  GetExcelSheetColumnNames(params) {
    return axios.get(`${serveUrl.rs}/EmployeeImportV2/GetExcelSheetColumnNames`, { params });
  },

  /**
   * @api{property} 获取花名册导入新增模板 <param name="moduleCode">模块编码（为0时为普通导入）</param><param name="isSimple">是否为简单模板</param>
   */
  GetImportTemplate(params) {
    return axios({
      method: "GET",
      url: `${serveUrl.rs}/EmployeeImportV2/GetImportTemplate`,
      responseType: "blob",
      params: params,
    });
  },

  /**
   * @api{property} /EmployeeImportV2/GetImportTemplate
   */
  GetImportTemplatePost(data) {
    return axios({
      method: "POST",
      url: `${serveUrl.rs}/EmployeeImportV2/GetImportTemplate?moduleCode=${data.moduleCode}`,
      responseType: "blob",
      data: data.data,
    });
  },

  /**
   * @api{property} 导出花名册导入错误数据
   */
  ExportErrorData(data) {
    return axios({
      method: "POST",
      url: `${serveUrl.rs}/EmployeeImportV2/ExportErrorData?isEdit=${data.isEdit}&moduleCode=${data.moduleCode}`,
      responseType: "blob",
      data: data.data,
    });
  },

  /**
   * @api{property} 获取花名册导入员工选择列表
   */
  GetImportEmployeeSelectList(params) {
    return axios.get(`${serveUrl.rs}/EmployeeImportV2/GetImportEmployeeSelectList`, { params });
  },

  /**
   * @api{property} 检查excel表格
   */
  CheckExcel(data) {
    return axios.post(`${serveUrl.rs}/EmployeeImportV2/CheckExcel?fileCacheKey=${data.fileCacheKey}&isEdit=${data.isEdit}&moduleCode=${data.moduleCode}`, data.data);
  },

  /**
   * @api{property} 重新验证excel数据
   */
  RepetitionCheckExcel(data) {
    return axios.post(`${serveUrl.rs}/EmployeeImportV2/RepetitionCheckExcel?isEdit=${data.isEdit}&moduleCode=${data.moduleCode}`, data.data);
  },

  /**
   * @api{property} 确认新增导入excel数据
   */
  ComfirmInsertImport(data) {
    return axios.post(`${serveUrl.rs}/EmployeeImportV2/ComfirmInsertImport?moduleCode=${data.moduleCode}`, data.data);
  },

  /**
   * @api{property} 确认修改导入excel数据
   */
  ComfirmEditImport(data) {
    return axios.post(`${serveUrl.rs}/EmployeeImportV2/ComfirmEditImport?moduleCode=${data.moduleCode}`, data.data);
  },

  /**
   * @api{property} 获取员工树
   */
  GetEmployeeTree() {
    return axios.get(`${serveUrl.rs}/Employee/GetEmployeeTree`);
  },
};

export default importUser;
